<%-- 
    Document   : w_revenuebyproduct
    Created on : Sep 22, 2013, 3:11:55 PM
    Author     : Trang
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="model.Role"%>
<%@page import="model.Staff"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="http://displaytag.sf.net" prefix="display" %>

<!DOCTYPE html>
<%
    Staff staff = (Staff) session.getAttribute("staff");

    if (staff == null) {
        response.sendRedirect(request.getContextPath() + "/Administration");
    } else if (!staff.getRoleList().contains(new Role(4))) {
        response.sendRedirect(request.getContextPath() + "/Administration/home");
    } else {
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Warehousing Management</title>
        <link href="<%= request.getContextPath()%>/css/style_for_page.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_for_menu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/style_addtion.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/adMenu.css" rel="stylesheet" type="text/css"/>
        <link href="<%= request.getContextPath()%>/css/tHeaderFooter.css" rel="stylesheet" type="text/css"/>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
        <link rel="stylesheet" href="/resources/demos/style.css" />

                <script>
                    $(function() {
                        $('#start').datepicker();
                        $('#end').datepicker();
                    });
                </script>
    </head>
    <body class="container">
        <% int i = 0;%>
    <header>
        <div class="header"> 
            <%@include file="/include/mHeader.jsp" %>
        </div>
        <div class="adContent">
            <div class="adMenu">
                <%@include file="/include/mMenu.jsp" %>
            </div>
        </div>
    </header>
    <div class="divcontent">
        <div class="headButton">

            <div id="errorMessage">
               
                <s:form cssStyle="float:left" action="get-revenue" namespace="/Administration/Revenue" theme="simple">
                <div id="sl12">
                        <p style="margin-left: -12px;"><b><i>From Date: </i></b><s:textfield name="startDate" size="30" id="start" /></p>
                    </div>
                    <div id="sl12">
                        <p><b><i>To: </i></b><s:textfield name="endDate" label="To" size="30"  id="end"/></p>
                    </div>
                    <div id="sl12">
                        <s:submit  value="Get Revenue" cssStyle="width: 100px; background-color: gray;" theme="simple" title="Get report by time range"/> 
                    </div>
                 </s:form>
            </div>
            <div id="errorMessage">
                <h3><b>COMPUTER PRODUCT RETAILER</b></h3>
                <p><b>23 Nguyen Trai - Thanh Xuan - Ha Noi</b></p>
                <p><b>0982396012/0914555444</b></p>

                <br>
            </div>
            <div id="errorMessage"/>
            <div style="margin: auto;  ">
                <h2 style="margin-left: 370px;  "><s:property value="title"/></h2>    
                <p style="margin-left: 420px;  "><b><i><s:property value="date"/></b></i></p> 
            </div>
            <img src="<%= request.getContextPath()%>/css/Paint1.png" alt="header Banner" width="1024" height="5"  title="Go to Adminitration Homepage">
            </br>
        </div>
    </div>
    <div class="content" >  
        <div class="datagrid2">  
            <table>
                <thead>
                    <tr>
                        <th> No </th> 
                        <th>Product Name</th>
                        <th>Unit Price</th>
                        <th>Total Quantity</th>
                        <th>Total Price</th>  
                    </tr>
                </thead>
                <tbody>

                <form name="fom" method="post"> 

                    <s:iterator value="revenues">
                        <% i++;%>
                        <tr> 
                            <td><%out.print(i);%></td>
                            <td><s:property value="product.name"/></td>
                            <td><s:property value="price"/></td>
                            <td><s:property value="totalQuantity"/></td>
                            <td><s:property value="totalPrice"/></td>                    
                        </tr>       
                    </s:iterator> 
                    <tr>
                        <td><b><i>Total Revenue</i></b></td>
                        <td></td>
                        <td></td>
                        <td></td> 
                        <td><b><s:property value="totalAmount + ' $'"/></b></td> 
                    </tr>
                </form>
                </tbody>
            </table></div>


    </div>   
</div>
<footer>
    <div id="footer">
        <%@include file="/include/iFooter.jsp" %>
    </div>    
</footer>
</body>
</html>
<%
    }
%>